package com.neasho.neashoadminv1.infrastructure.exception

enum class BusinessCode(val code: Int, val message: String) {
    user_not_exist(10001, "用户不存在或密码错误"),
    user_exist(10002, "用户已存在"),
    user_password_error(10003, "用户密码错误"),
    user_not_login(10004, "用户未登录"),
    user_not_permission(10005, "用户无权限"),
    user_not_auth(10006, "用户未授权"),
    user_not_admin(10007, "用户不是管理员"),
    user_login_failed(10008, "用户登录失败"),
    user_credetial_expired(10009, "用户凭证过期"),
    user_credetial_invalid(10010, "用户凭证无效"),
    user_credetial_locked(10011, "用户凭证锁定"),


    unknow(50000, "未知错误")
    ;

    fun create(message: String): BusinessException {
        return BusinessException(unknow.code, message)
    }

    fun exception(): BusinessException = BusinessException(this.code, this.message)
}